<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo "Cine BD - Ingresso para $_POST[filme]"; ?></title>
</head>
<style type="text/css">

	body {
		background-color: #FFF;
		background-image:url(../images/logo.png);
		background-attachment:fixed;

		vertical-align:top;
		text-align:center;
		font-family:"Courier New", Courier, monospace;
		font-size:12px;
		border-style:dashed;
		margin-bottom:20px;
		margin-left:20px;
		margin-right:20px;
	}

	.title {
		font-family:"Courier New", Courier, monospace;
		font-size:20px;
		font-weight:bold;
	}
	
	.titles {
		font-family:"Courier New", Courier, monospace;
		font-size:14px;
		font-weight:bold;
	}
	
</style>
<body>
<?php

try {
	
		require_once("php/config.php");
        require_once("php/postgres.php");
		$confs = $GLOBALS["CONFIGS"]["PSQL_DB"];
        $pgcon = new PostgresConnection($confs["HOST"], $confs["PORT"], $confs["USER"], $confs["PASSWORD"], $confs["DATABASE"]);
		$cod = $pgcon->generateTicket($_POST["filme"], $_POST["data"], $_POST["hora"], $_COOKIE["checkLogin"]);
		if ($cod == null) {
		
			die("<span style='color:red;'>Desculpa, mas sua requisi&ccedil;&atilde;o n&atilde;o pode ser processada agora. Volte mais tarde.</span>");
		}
		
} catch (PostgresConnectionException $pce) {
                        
        die("<span style='color:red;'>Desculpa, mas sua requisi&ccedil;&atilde;o n&atilde;o pode ser processada agora. Volte mais tarde.</span>");
}
?>
<table align="center" style="margin-bottom:50px">
	<tr>
		<td class="title"><br /><span>Cine BD - Ingresso</span></td>
	</tr>
	<tr>
        <td class="titles" style="font-size:18px"><span><?php echo'' .$_POST["filme"] .''; ?></span></td>
    </tr>
    <!--<tr>
   		<td><span>Usu&aacute;rio: <?php echo'' .$_COOKIE["checkLogin"] .'';?> </span></td>
    </tr>-->
    <tr>
   		<td class="titles"><span>Nome: <?php echo'' .$_POST["prenome"] .'';?> </span></td>
    </tr>
    <tr>
   		<td class="titles"><span>Ingresso: <?php echo'' .$_POST["ingresso"] .'';?> </span></td>
    </tr>
    <tr>
       <td class="titles"><span>Pre&ccedil;o: <?php echo'' .$_POST["preco"] .'';?> reais </span></td>
    </tr>
    <tr>
   		<td class="titles"><span>Data: <?php echo'' .$_POST["data"] .'';?> </span></td>
    </tr>
    <tr>
        <td class="titles"><span>Hor&aacute;rio: <?php echo'' .$_POST["hora"] .'';?> </span></td>
    </tr>
    <tr>
        <td class="titles"><span>C&oacute;digo: <?php echo $cod; ?></span></td>
    </tr>
<br />
<br />
</table>
</body>
</html>